/*
 * Copyright (c) 2018 maoyan.com
 * All rights reserved.
 *
 */
package com.darren.euc.dao.impl;

import com.darren.euc.dao.MeetingroomOrderDao;
import com.darren.euc.entity.MeetingroomOrder;

import java.math.BigInteger;

import org.hibernate.Query;
import org.hibernate.Session;
import org.springframework.stereotype.Repository;

/**
 * 在这里编写类的功能描述
 *
 * @author fangwenhao
 * @created 2018/3/13
 */
@Repository
public class MeetingroomOrderDaoImpl extends BaseDaoImpl<MeetingroomOrder, Integer> implements MeetingroomOrderDao {
	
	@Override
	public BigInteger getCurrentDayCount(Integer orderId){
		Session session = sessionFactory.getCurrentSession();	
		Query query  = session.createSQLQuery("  select count(1) from euc_meetingroom_order where datediff(now(),create_time) = 0 and order_id <= ? ; ");
		query.setParameter(0, orderId);
		BigInteger count = (BigInteger) query.uniqueResult();
		return  count;
	}
}
